#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTcpServer>
#include <QTcpSocket>
#include <QMessageBox>
#include <QNetworkInterface>
#include <QString>
#include <QPainter>
#include <QHostInfo>
#include <QDateTime>

#include <QFile>      //文件操作
#include <QHostAddress> //IP地址
#include <QMessageBox> //提示对话框
#include <QPainter>


QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    //函数
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void Initialize();
    void paintEvent(QPaintEvent *event);
    QHostAddress getHostIPV4Address();

    //数据   只考虑连接一个
    QTcpServer* TCPServer;
    QTcpSocket* TCPSocket; //用来获得连接客户端的SOCKET套接字
    QTcpSocket* TcpSocket;  //客户端
    QString localHostName; //本主机名
    QPixmap pic;

    bool isconnection;


private slots:
    void ServerNewConnection();

    void on_Start_clicked();

    void on_Exit_clicked();

    void solt_SendMessage(); //发送消息的槽

    void RecvMessage(); //接收消息的槽

    void DisConnect();

    void on_pushButton_Sent_clicked();

    void on_pushButton_clicked();

    void on_slot_disconnect_clicked();

private:
    Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
